define(['app'],function(app){return {module: function($scope, $http, eventBusService, httpService, params, configService) {
		$scope.form.father_id=params.father_id;

		httpService.post(app.urls.menu_select,{"id":params.father_id},function(data){
			if("0000" === data.code){
				$scope.menu_name = data.data[0].name;
				$scope.findButton(data.data[0].id);
			}else{
				alert(data.msg);
			}
		});
		$scope.findButton=function(menu_id){
			httpService.post(app.urls.button_select,{"menu_id":menu_id},function(data){
				if("0000" === data.code){
					$scope.buttons = data.data;
				}else{
					alert(data.msg);
				}
			});
		}

		$scope.find = function(){
			httpService.postpage(app.urls.app_select, $scope.form, function(data) {
				if ("0000" === data.code) {
					$scope.rows = data.data;
				} else {
					alert(data.msg);
				}
			});
		}
		$scope.find();
		//按钮点击事件-条件查询
		$scope.select = function(){
			$scope.page.current = 1;
			//执行查询
			$scope.find();
		}
		$scope.clickBtn=function(event) {
			if (event == 'set') {
				var values = [];
				$('#'+$scope.controllerName+' input[name="dataPk"]:checked').each(function(){
					values.push($(this).val());
				});
				if(values.length < 1){
					eventBusService.publish('modal.alert', {"title":"操作提示","content":"请选择您要修改的数据。"});
				}else if(values.length > 1){
					eventBusService.publish('modal.alert', {"title":"操作提示","content":"不能同时选择多条。"});
				}else{
					var menu = {};
					menu.url = "modules/content/dataexchange/developer/set?father_id="+params.father_id+"&fk_app="+values[0];
					eventBusService.publish("modules.content.load",menu);
				}
			}
		}
		//选择数据
		$scope.optData = function (element) {
			if($(element).find("input[name='dataPk']").is(":checked")){
				$(element).find("input[name='dataPk']").prop("checked",false);
				$(element).removeClass("opt_tr");
			}else{
				$(element).find("input[name='dataPk']").prop("checked",true);
				$(element).addClass("opt_tr");
			}
		}
		$scope.checkAll = function(target) {
			$("#" + $scope.controllerName + " input[name='dataPk']").each(function() {
				if ($(this).prop("checked")) {
					$(this).prop('checked', false);
					$(this).parents("tr").removeClass("opt_tr");
				} else {
					$(this).prop('checked', true);
					$(this).parents("tr").addClass("opt_tr");
				}
			})
		}
}}});